// eslint.config.js
import js from '@eslint/js';
import vuePlugin from 'eslint-plugin-vue';
import tsParser from '@typescript-eslint/parser';
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
import { configureVueProject } from '@vue/eslint-config-typescript'
configureVueProject({ scriptLangs: ['ts', 'tsx'] })
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup

export default [
    js.configs.recommended,
    ...vuePlugin.configs['flat/recommended'],
    {
        files: ['**/*.{js,ts,vue}'], // 合并所有文件类型
        languageOptions: {
            parser: tsParser,
            parserOptions: {
                project: './tsconfig.json',
                extraFileExtensions: ['.vue'], // 关键修复
                sourceType: 'module'
            }
        },
        ignores: [
            '**/node_modules/**',
            'dist/**',
            '**/*.d.ts',
            '*.config.js',
            'vite.config.ts'
        ],
        rules: {
            // 添加自定义规则
        }
    }
];